Skip to content

fix: (CXSPA-9504) support Chinese address in address book#21272

Draft
espada945 wants to merge 35 commits intodevelopfrom
bugfix/CXSPA-9504
Draft

fix: (CXSPA-9504) support Chinese address in address book#21272
espada945 wants to merge 35 commits intodevelopfrom
bugfix/CXSPA-9504

Conversation

@espada945
Copy link
Copy Markdown
Member

Summary

  • Add cascading city/district dropdowns when China is selected as country
  • Change "State" label to "Province" for Chinese addresses
  • Make cellphone required for Chinese addresses
  • Add district field for Chinese addresses

Test plan

  • Select China as country → verify city/district dropdowns and Province label
  • Add complete Chinese address → verify successful save
  • Switch to non-China country → verify form reverts to default

Add province/city/district fields for Chinese addresses, make
cellphone required, and display Province instead of State label.
@espada945 espada945 requested review from a team as code owners March 23, 2026 08:32
@github-actions github-actions bot marked this pull request as draft March 23, 2026 08:50
@espada945 espada945 marked this pull request as ready for review March 24, 2026 03:30
@github-actions
Copy link
Copy Markdown
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft March 24, 2026 03:36
@espada945 espada945 marked this pull request as ready for review March 24, 2026 04:48
@cypress
Copy link
Copy Markdown

cypress bot commented Mar 24, 2026

spartacus    Run #52719

Run Properties:  status check failed Failed #52719  •  git commit 33fe26944f ℹ️: Merge 9e015424b2ba29f7c6c601e4634d3636d4f0a7f9 into 0daa1855b5a77ee72f8b3e68053c...
Project spartacus
Branch Review bugfix/CXSPA-9504
Run status status check failed Failed #52719
Run duration 04m 31s
Commit git commit 33fe26944f ℹ️: Merge 9e015424b2ba29f7c6c601e4634d3636d4f0a7f9 into 0daa1855b5a77ee72f8b3e68053c...
Committer espada945
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 3
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 100
View all changes introduced in this branch ↗︎

Tests for review

Failed  cypress/e2e/regression/variants/apparel-checkout-as-guest.core-e2e.cy.ts • 1 failed test • B2C

View Output Video

Test Artifacts
Apparel - checkout as guest > Desktop > should perform checkout as guest, create an account and verify guest data Test Replay Video
Flakiness  cypress/e2e/ssr/pages.core-e2e.cy.ts • 3 flaky tests • SSR

View Output Video

Test Artifacts
SSR > should render homepage Test Replay Video
SSR > should render PLP Test Replay Video
SSR > should render PDP Test Replay Video

…pport

- Use inject() for ChineseAddressService instead of modifying constructor
- Rename isChinaAddress to isChineseAddress
- Extract HTTP calls to ChineseAddressService with proper error handling and typed responses
- Use OccEndpointsService.buildUrl() instead of hardcoded URLs
- Reset selectedRegion$/selectedCity$ when switching away from CN
- Reorder form fields: Province before City for Chinese address
- Refresh cities/districts on language change via LanguageService
- Skip address verification for Chinese addresses
- Display city/district/region/country names instead of isocodes in address book
- Add city and cityDistrict fields to Address model
- Request FULL fields for address list API
@github-actions github-actions bot marked this pull request as draft March 26, 2026 08:36
espada945 and others added 5 commits March 26, 2026 17:09
Disable city dropdown until province is selected and district dropdown
until city is selected for Chinese addresses. Show helpful placeholder
text ("Please select a province/city first") when disabled.
- Add province/district/placeholder translations for zh and zh_TW
- Refresh Chinese placeholders on language switch
- Convert cities$/districts$ from observables to arrays with subscriptions
- Fix spec tests to match new array properties
- Fix prettier formatting in occ-user-address.adapter.ts
@espada945 espada945 marked this pull request as ready for review March 31, 2026 05:43
@github-actions
Copy link
Copy Markdown
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft March 31, 2026 06:11
@espada945 espada945 marked this pull request as ready for review March 31, 2026 06:42
espada945 and others added 2 commits April 10, 2026 11:05
…ider, prettier formatting

- Add SiteAdapter mock provider to OpfCheckoutBillingAddressFormComponent spec
  (required after SiteConnector was added as UserAddressService dependency)
- Fix prettier formatting in address-form.component.ts
- Use address name instead of isocode for country and region in address card
}
}

protected updateChinesePlaceholders(): void {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This empty method is never used.

getCities(
regionIsocode: string
): Observable<{ isocode?: string; name?: string }[]> {
return this.siteConnector.getCities(regionIsocode);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using NgRx store pattern instead of direct API call would be better for consistency and performance, as getDeliveryCountries() and getRegions() already use.

  1. Performance Issues with Current Implementation

Problem: Multiple API calls for same data
// In address-form.component.ts:194-218
combineLatest([this.selectedRegion$, this.languageService.getActive()])
.pipe(switchMap(([regionIsocode]) => {
return this.userAddressService.getCities(regionIsocode); // 🔴 API call every time!
}))

Every time language changes → new API call
User switches back to previous region → API call again
Multiple address forms on screen → duplicate API calls

  1. Consistency with Existing Architecture

The codebase follows a clear pattern for location data:

Countries → Store (user/store/reducers/delivery-countries.reducer.ts)
Regions → Store (user/store/reducers/regions.reducer.ts)
Cities → Direct API ❌ (breaks pattern)
Districts → Direct API ❌ (breaks pattern)

…ider, prettier formatting

- Add SiteAdapter mock provider to OpfCheckoutBillingAddressFormComponent spec
- Add loadCities/loadDistricts to MockSiteAdapter in site.connector.spec.ts
- Fix prettier formatting in address-form.component.ts
- Display country/region name instead of isocode in address book card
@espada945 espada945 marked this pull request as ready for review April 10, 2026 09:33
@github-actions
Copy link
Copy Markdown
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft April 12, 2026 05:43
@espada945 espada945 marked this pull request as ready for review April 12, 2026 06:00
@github-actions
Copy link
Copy Markdown
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft April 12, 2026 06:01
@espada945 espada945 marked this pull request as ready for review April 12, 2026 06:42
@github-actions
Copy link
Copy Markdown
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft April 12, 2026 10:51
@espada945 espada945 marked this pull request as ready for review April 12, 2026 11:11
@github-actions
Copy link
Copy Markdown
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft April 12, 2026 14:18
@espada945 espada945 marked this pull request as ready for review April 12, 2026 14:26
@github-actions
Copy link
Copy Markdown
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft April 12, 2026 15:09
@espada945 espada945 marked this pull request as ready for review April 12, 2026 15:22
@github-actions
Copy link
Copy Markdown
Contributor

Merge Checks Failed

Please push a commit to re-trigger the build.
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft April 12, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants